/**
 * @Author       : cxh
 * @Date         : 2021-12-29 17:59:11
 * @LastEditTime : 2021-12-29 23:05:10
 * @LastEditors  : cxh
 * @Description  : 公钥获取的接口
 * @FilePath     : \vue_WorkSpace\egg-wpt-server\app\controller\pub.js
 */
'use strict';
const keyController = require('./../lib/keyController');

const Controller = require('egg').Controller;

class UserController extends Controller {
  async index() {
    const {
      ctx,
    } = this;
    ctx.body = 'hi,userController';
  }

  async getPublicKey() {
    console.log('111');
    const {
      ctx,
    } = this;
    const keys = await keyController.getKeys();
    const publicKey = keys.publicKey;
    console.log(publicKey);
    console.log(typeof publicKey);
    ctx.body = JSON.stringify({
      success: true,
      msg: '',
      data: publicKey,
    });
  }

}

module.exports = UserController;
